//headers 
#include<algorithm>
#include<cassert>
#include<cstdio>
#include<queue>
#include<deque>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<deque>
#include<set>
#include<string>
#include<sstream>
#include<stack>
#include<streambuf>
#include<vector>
using namespace std;

//macros
#define LET(x,a) typeof(a) x(a)
#define FOR(i,a,n) for(LET(i,a);i!=n;i++)
#define REP(i,n) FOR(i,0,n)
#define sz size()
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define PRINT(x) REP(_,x.sz) cout<<x[_]<<" "; cout<<endl;
const int INF = (int) 1e8;
#define VI vector<int>
#define VS vector<string>
#define VVI vector< vector<int> >
#define PII pair<int,int>
#define VII vector< PII >
#define LL long long
#define mp make_pair


//code of suren

VI findDiagonals(int n, int m){
  Vi ans;
  if(n==m) FOR(i,2,n) { ans.pb(i); return ans; }
}


int main(){
  int n , m;
  while(cin>>n>>m && n && m){
    LL ans = 0;
    ans += n * n * (n-1) / 2;
    ans += m * m * (m-1) / 2;
    VI diags = findDiagonals(n,m);
    ans*=2;
    cout<<ans<<endl;
  }
  return 0;
}
